#!/bin/sh
echo "running phpcs"
cd "`dirname "$0"`"
source ./settings.sh
arFiles=`php listDirs.php "$cvs_pear"`

if [ ! -d "$tmp_phpcs" ]; then
    mkdir "$tmp_phpcs"
fi

rm $tmp_phpcs/*.xml

cd "$cvs_pear"


for i in ${arFiles[@]}; do
    if [ -d "$cvs_pear/$i" ]; then
        #run phpcs
        echo $i
        cd "$cvs_pear/$i"
        php -c "$php_ini"\
        /usr/bin/phpcs --report=xml --standard=PEAR \
         --ignore=test/,tests/,docs/,examples/ . \
         > "$tmp_phpcs/$i.xml"
    fi
done

echo "phpcs done"
